Spot-On
spot-on-smpwindow.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_smpwindow_h_
29 #define _spoton_smpwindow_h_
30 
31 #include <QPointer>
32 
33 #include "spot-on-smp.h"
34 #include "ui_spot-on-smpwindow.h"
35 
36 class QKeyEvent;
37 class spoton;
38 
40 {
41  public:
42  spoton_smpwindow_smp(const QString &guess, spoton *spoton)
43  {
44  m_smp = new spoton_smp(spoton);
45  m_smp->setGuess(guess);
46  }
47 
49  {
50  delete m_smp;
51  }
52 
53  QByteArray m_publicKey;
54  QHash<QByteArray, char> m_cache;
55  QString m_keyType;
56  QString m_name;
57  qint64 m_oid;
58  spoton_smp *m_smp;
59 };
60 
61 class spoton_smpwindow: public QMainWindow
62 {
63  Q_OBJECT
64 
65  public:
66  spoton_smpwindow(spoton *parent);
68  QMap<QString, QByteArray> streams(const QStringList &keyTypes) const;
69  void populateSecrets(void);
70  void show(spoton *parent);
71 
72  private:
73  QHash<QByteArray, spoton_smpwindow_smp *> m_smps;
74  QPointer<spoton> m_parent;
75  Ui_spoton_smpwindow m_ui;
76  void generateSecretData(spoton_smpwindow_smp *smp);
77  void keyPressEvent(QKeyEvent *event);
78  void showError(const QString &error);
79 
80  private slots:
81  void slotClose(void);
82  void slotExecute(void);
83  void slotGenerateData(void);
84  void slotParticipantDeleted(const QString &oid, const QString &type);
85  void slotParticipantNameChanged(const QByteArray &publicKeyHash,
86  const QString &name);
87  void slotPrepareSMPObject(void);
88  void slotPurgeSMPStateMachines(void);
89  void slotRefresh(void);
90  void slotRemove(void);
91  void slotSMPMessageReceivedFromKernel(const QByteArrayList &list);
92  void slotSaveCombinationBoxOption(const QString &text);
93  void slotSaveSpinBoxOption(int value);
94  void slotSetIcons(void);
95 };
96 
97 #endif
spoton
Definition: spot-on.h:433
spoton_smpwindow
Definition: spot-on-smpwindow.h:61
spoton_smpwindow_smp
Definition: spot-on-smpwindow.h:39
spoton_smp
Definition: spot-on-smp.h:42